<template>
  <div class="singer-brief">
    <div class="s-img">
      <img :src="singerBrief.picUrl" alt="404" />
      <div class="myself" @click="toMyself(singerBrief.accountId)">
        <el-icon><user /></el-icon>
        <span>个人主页</span>
        <el-icon><arrow-right /></el-icon>
      </div>
    </div>
    <div class="s-menu">
      <div class="title">
        <div>
          <span class="tol">歌手</span>
          <span class="title-a">{{ singerBrief.name }}</span>
        </div>
        <div class="like">
          <span @click="addLike(singerBrief.id)">
            <el-icon v-show="!collect"><star /></el-icon>
            <el-icon v-show="collect"><star-filled /></el-icon>
            {{ collect ? '已收藏' : '收藏' }}
          </span>
        </div>
      </div>
      <div class="title-son" style="margin-top: 30px">
        <span>
          <el-icon class="song-icon"><service /></el-icon>
          单曲数 : {{ singerBrief.musicSize }}
        </span>
      </div>
      <div class="title-son">
        <span>
          <el-icon class="song-icon"><film /></el-icon>
          专辑数 : {{ singerBrief.albumSize }}
        </span>
      </div>
      <div class="title-son">
        <span>
          <el-icon class="song-icon"><video-camera /></el-icon>
          MV数 : {{ singerBrief.mvSize }}
        </span>
      </div>
      <div class="title-son">
        <el-icon class="song-icon"><mic /></el-icon>
        <a href="#" class="showTime">演出数 : 1</a>
      </div>
    </div>
  </div>
</template>

<script lang="ts">
import { defineComponent, ref } from 'vue'

export default defineComponent({
  props: {
    singerBrief: {
      type: Object,
      default: () => ({})
    }
  },
  setup() {
    const collect = ref(false)
    const addLike = (id: number) => {
      collect.value = !collect.value
      console.log(id)
    }
    const toMyself = (id: number) => {
      console.log(id)
    }
    return {
      collect,
      addLike,
      toMyself
    }
  }
})
</script>

<style scoped lang="less">
.singer-brief {
  display: flex;
  flex-wrap: wrap;
  width: 100%;
  .s-img {
    width: 25%;
    margin: 0 20px;
    position: relative;

    img {
      width: 100%;
    }
    .myself {
      border: 1px solid rgba(255, 255, 255, 0.4);
      background: rgba(0, 0, 0, 0.1);
      color: rgba(255, 255, 255, 0.9);
      padding: 5px 8px;
      font-size: 14px;
      position: absolute;
      bottom: 15px;
      left: 50%;
      transform: translateX(-50%);
      border-radius: 15px;
      cursor: pointer;

      &:hover {
        background: rgba(0, 0, 0, 0.3);
      }
    }
  }
  .s-menu {
    width: 70%;
    display: flex;
    flex-direction: column;
    .title {
      display: flex;
      justify-content: space-between;
      .tol {
        background: red;
        font-size: 14px;
        color: #fff;
        padding: 2px 6px;
        margin-right: 7px;
      }
      .title-a {
        font-size: 23px;
        font-weight: 10px;
      }
      .like {
        border: 1px solid #e1e1e2;
        padding: 4px 8px;
        font-size: 14px;
        cursor: pointer;
        border-radius: 5px;
        &:hover {
          background: #f5f5f7;
        }
      }
    }
    .title-son {
      margin-top: 10px;
      font-size: 14px;
      .showTime {
        text-decoration: underline;
        color: #666;
      }
      .song-icon {
        font-size: 20px;
        position: relative;
        top: 3px;
        left: -3px;
      }
    }
  }
}
</style>
